package mysrpringboot.springboot.controller;


import mysrpringboot.springboot.Service.PositionService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.io.IOException;
import java.util.List;
import java.util.Map;

@RestController
@RequestMapping("/order")
public class PositionController {
    @Autowired
    private PositionService  service;

    // 测试页面
    @GetMapping({"/","/index"})
    public   String  indexPage(){
        return  "haha";
    }
    @RequestMapping("/search")
    public  List<Map<String,Object>>  searchPosition(String  keyword)throws  IOException{
        List<Map<String,Object>> list = service.searchPos(keyword);
        return  list;
    }
    @RequestMapping("/importAll")
    @ResponseBody
    public   String  importAll(){
        try {
            service.importAll();
        } catch (IOException e) {
            e.printStackTrace();
        }
        return  "success";
    }
}